BOLT 11 - invoices
2022-04-10 ยท 2 min read
See: LDK - lightning-invoice crate
- bech32 encoded
Fields with known tags: lightning-invoice::TaggedField
pub enum TaggedField {
PaymentHash(Sha256),
Description(Description),
PayeePubKey(PayeePubKey),
DescriptionHash(Sha256),
ExpiryTime(ExpiryTime),
MinFinalCltvExpiry(MinFinalCltvExpiry),
Fallback(Fallback),
PrivateRoute(PrivateRoute),
PaymentSecret(PaymentSecret),
Features(InvoiceFeatures),
}
Routing hints #
Private nodes behind a public LSP can still accept payments via Routing Hints. Here, the private node advertises an invoice with the final LSP -> Private Node hop encoded into the invoice, so other nodes can still route to the Private Node even though they're not publicly advertised or otherwise reachable.
lightning-invoice::PrivateRoute
/// Private routing information
///
/// # Invariants
/// The encoded route has to be <1024 5bit characters
/// long (<=639 bytes or <=12 hops)
pub struct PrivateRoute(RouteHint);
ln::routing::router::RouteHint
/// A list of hops along a payment path terminating
/// with a channel to the recipient.
pub struct RouteHint(pub Vec<RouteHintHop>);
ln::routing::router::RouteHintHop
/// A channel descriptor for a hop along a payment path.
pub struct RouteHintHop {
/// The node_id of the non-target end of the route
pub src_node_id: PublicKey,
/// The short_channel_id of this channel
pub short_channel_id: u64,
/// The fees which must be paid to use this channel
pub fees: RoutingFees,
/// The difference in CLTV values between this
/// node and the next node.
pub cltv_expiry_delta: u16,
/// The minimum value, in msat, which must be
/// relayed to the next hop.
pub htlc_minimum_msat: Option<u64>,
/// The maximum value in msat available for
/// routing with a single HTLC.
pub htlc_maximum_msat: Option<u64>,
}